package com.shd.edanpei.ui.adapter;

import android.content.Context;
import android.view.View;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shd.edanpei.R;
import com.shd.edanpei.base.BaseQuickImageAdapter;
import com.shd.edanpei.bean.OrderBean;

/**
 * Created by mc on 2018/9/4.
 * yang-wen-wen
 */

public class TestOrderAdapter extends BaseQuickImageAdapter<OrderBean> {

    private int from;

    public TestOrderAdapter(Context context, int from) {
        super(context, R.layout.item_order);
        this.from = from;
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderBean item) {
        int layoutPosition = helper.getLayoutPosition();
        if (layoutPosition == 0) {
            helper.getView(R.id.top).setVisibility(View.VISIBLE);
        } else {
            helper.getView(R.id.top).setVisibility(View.GONE);
        }
        if (layoutPosition == getData().size() - 1) {
            helper.getView(R.id.bottom).setVisibility(View.VISIBLE);
        } else {
            helper.getView(R.id.bottom).setVisibility(View.GONE);
        }

        if (from == 0) {
            helper.setText(R.id.tv_info, "已创建" + item.getName() + "客户订单");
        } else if (from == 1) {
            helper.setText(R.id.tv_info, item.getPublisherName() + "创建新订单了");
        }

        helper.setText(R.id.tv_time, item.getCreateTime());
    }
}
